"""
    Software : PyCharm
    File     : validates.py
    Time     : 2021/5/31 17:46
    Author   : Pontoon
    describe :
"""
from rest_framework import serializers
from rest_framework.exceptions import ValidationError

from projects.userprofile.models import UserProfile
from .models import Message


class MessageValidate(serializers.ModelSerializer):
    from_user = serializers.PrimaryKeyRelatedField(queryset=UserProfile.objects)
    to_user = serializers.PrimaryKeyRelatedField(queryset=UserProfile.objects)

    class Meta:
        model = Message
        fields = ["from_user", "to_user", "content"]




